import request from '@/utils/request'

// 分类列表
export function listCategory(query) {
  return request({
    url: '/ug/category/list',
    method: 'get',
    params: query
  })
}

// 分类详情
export function getCategory(categoryId) {
  return request({
    url: '/ug/category/' + categoryId,
    method: 'get'
  })
}

// 新增分类
export function addCategory(data) {
  return request({
    url: '/ug/category',
    method: 'post',
    data
  })
}

// 修改分类
export function updateCategory(data) {
  return request({
    url: '/ug/category',
    method: 'put',
    data
  })
}

// 删除分类（支持批量）
export function delCategory(ids) {
  return request({
    url: '/ug/category/' + ids,
    method: 'delete'
  })
}

// 修改分类状态
export function changeCategoryStatus(categoryId, status) {
  return request({
    url: '/ug/category/changeStatus',
    method: 'put',
    data: { categoryId, status }
  })
}
